package de.hwrBerlin.dataMining.view.vImage.figures;

import org.dom4j.Document;
import org.dom4j.Element;
import org.eclipse.swt.graphics.GC;

public class Rectangle extends FilledFigure {

    public int width = 0, height = 0;
    
    public Rectangle(int pX, int pY, int pWidth, int pHeight) {
        x = pX;
        y = pY;
        width = pWidth;
        height = pHeight;
    }

    public void paintImage(GC pGc){
        setValuesToGc(pGc);
        pGc.fillRectangle(x, y, width, height);
        pGc.drawRectangle(x, y, width, height);
    }

    @Override
    public org.eclipse.swt.graphics.Rectangle getBounds() {
        return new org.eclipse.swt.graphics.Rectangle(0, 0, width, height);
    }

    @Override
    public void paintSVG(Document pDocument) {
        Element root = pDocument.getRootElement();
        
        Element rect = root.addElement("rect");

        setValuesToSVGElement(rect);
        
        rect.addAttribute("x", ""+x);
        rect.addAttribute("y", ""+y);
        rect.addAttribute("width", ""+width);
        rect.addAttribute("height", ""+height);
    }
    
}
